<?php

namespace app\factory\logic;

use app\model\DiseaseCategory;

class DiseaseCategoryLogic
{
    /**
     * @Description 下拉选择
     * @author: zj
     * @param array $param
     * @time 2024/03/28 15:59:06
     * @return array
     * @throws \think\db\exception\DbException
     */
    public function selectList(array $param)
    {
        $model = new DiseaseCategory();
        $query = $model->field('id,name')
            ->where('delete_time',$model::IS_DELETE_NO);
        if ($param['name']) {
            $query->where('name','like','%'.trim($param['name']).'%');
        }

        return $query->order('id DESC')
            ->paginate([
                'list_rows' => $param['page_size'],
                'page' => $param['page']
            ])
            ->toArray();
    }
}